<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>民主评议</title>
    <link rel="stylesheet" href="../../addons/party_member/public/css/weui.min.css">
    <link rel="stylesheet" href="../../addons/party_member/public/css/jquery-weui.min.css">

    <!-- body 最后 -->
    <script src="../../addons/party_member/public/js/jquery.min.js"></script>
    <script src="../../addons/party_member/public/js/jquery-weui.min.js"></script>

    <!-- 如果使用了某些拓展插件还需要额外的JS -->
    <script src="../../addons/party_member/public/js/swiper.min.js"></script>
    <script src="../../addons/party_member/public/js/city-picker.min.js"></script>
    <script src="../../addons/party_member/public/js/function.js"></script>
    <style>
        body{
            margin: 0;
            padding: 0;
            background: #f9f9f9;
        }
        .head{
            display: block;
            position: relative;
            width: 100%;
            height: 43px;
            background: #ffffff;
            text-align: center;
            font-size: 18px;
            line-height: 43px;
            font-family: -webkit-body;
            color: #333333;

        }
        .head_return{
            display: inline-block;
            position: absolute;
            left: 10px;
            top: 10px;
            width: 20px;
            height: 23px;
            background: url("../addons/party_member/public/image/evaluation/return.png") no-repeat;
            background-size: 12px 23px;

        }
        .main{
            width: 100%;
            background: url("../addons/party_member/public/image/activityDetail/bg.png") ;
            background-size: 100% 100%;
        }

        .main_head span{
            margin: auto;
            width: 120px;
            display: block;
            padding: 10px;
            border-bottom: 2px solid #cccccc;
            font-family: 微软雅黑;
            font-weight: bold;
        }
        .main_list{
            position: relative;
            display: block;
            width: 100%;
            height: 180px;
            background: none;
            margin-top: 20px;
        }
        .banner_headPic{
            display: inline-block;
            position: absolute;
            left: 50%;
            margin-left: -80px;
            width: 80px;
            height: 80px;
            border-radius: 50%;
            margin-top: 14px;

            background-size: 80px 100px;
        }

        .banner_info{
            display: inline-block;
            position: absolute;
            margin-top: 30px;
            left: 50%;
            margin-left: 10px;
            height: 80px;
        }
        .banner_info span{
            display: block;
            margin: auto;
            font-family: 微软雅黑;

        }
        .selected:before{
            content: "\EA06";
            background-color:#FFFFFF;
            color: red;
        }
        .client-type{
            display: block;
            width: 100%;
            position: absolute;
            bottom: 30px;
            text-align: center;
        }
        .main_list:before{
            content: " ";
            position: absolute;
            bottom: 3px;
            top: 100%;
            width: 80%;
            right: 10%;
            height: 3px;
            border-top: 3px solid #cccccc;
            -webkit-transform-origin: 0 0;
            transform-origin: 0 0;
            -webkit-transform: scaleY(.5);
            transform: scaleY(.5);
            left: 10%;
        }

    </style>
</head>
<body>
<div class="head">
    <span class="head_return"></span>
    民主评议
</div>
<div class="main">
    <div class="main_head">
        <span>{$data['topic']}</span>
    </div>

    {loop $data['list'] $index $item}
    <div class="main_list" data-id="{$item['id']}">
        <div class="banner_headPic"
             style="background: url('{$item['photo']}') no-repeat;"
        ></div>
        <div class="banner_info">
            <span>{$item['membername']}</span>
            <span>{$item['title']}</span>
        </div>
        <div class="weui-cell__bd client-type">
            <span class="person" >
                {loop $item['selects'] $index $item1}
                <span style="white-space:pre"> </span><a href="javascript:;" class="weui-icon-circle" data-type="{$item1['value']}"></a>
                <span style="white-space:pre"> </span><span class="user-type">{$item1['name']}</span>
                {/loop}
            </span>
        </div>
    </div>
    {/loop}



    <div style="position:relative;bottom:0px;display:block;left:2%;width: 96%;padding: 20px 0">
        <a href="javascript:;" id="sb" class="weui-btn weui-btn_warn">提交</a>
    </div>
</div>

<script>
    $(function () {
        var heigth=$(window).height();
        var mainH=$(".main").height();
        if(mainH<heigth){
            $(".main").css('height',heigth-43);
        }

        $(".person .weui-icon-circle").click(function () {
            $(this).siblings(".selected").removeClass("selected");
            $(this).addClass("selected");
        })

    })
    
    $(function () {
        $("#sb").click(function () {

            var arr =[]
            var err = false
            $(".main_list").each(function (index,element) {
                var commentid = $(element).attr('data-id')
                var performace=$(element).find(".weui-icon-circle.selected").attr('data-type')

                arr.push({
                    commentid:commentid,
                    performace:performace
                })
                if(typeof performace == "undefined"){
                    err= true
                }


            })

            if(err){
                $.alert( "请全部勾选","提示",function () {});
            }else{

                $.showLoading();
                $.post('{php echo $this->createMobileUrl("reviewAjax")}',{
                    obj:JSON.stringify({arr:arr}),
                },function (data) {
                    $.hideLoading();
                    if(data['status']){
                        $.alert(data['result'], "提示",function () {

                        });

                    }else{
                        $.alert(data['result'], "提示",function () {
                            refresh();
                        });
                    }
                },'json')

            }

        })
    })
    
</script>
</body>
</html>